package com.g17.virtualpetbackend.controller;

import com.g17.virtualpetbackend.entity.Assistant;
import com.g17.virtualpetbackend.entity.Case;
import com.g17.virtualpetbackend.entity.Receptionist;
import com.g17.virtualpetbackend.entity.Vet;
import com.g17.virtualpetbackend.service.CaseService;
import com.g17.virtualpetbackend.service.StudyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("study")
public class StudyController {
    @Resource
    StudyService studyService;

    @Autowired
    private CaseService caseService;

    @GetMapping("/assistantWork")
    public Assistant getAssistantWork(String work){
        return studyService.findAssistantWork(work);
    }

    @GetMapping("/receptionistQA")
    public List<Receptionist> getReceptionistQA(){
        return studyService.findQA();
    }

    @GetMapping("/vetPart")
    public Vet getVetPart(String part){
        return studyService.findVetPart(part);
    }

    @GetMapping("/case")
    public Map<String,List<Map<String,String>>> getALLCaseStudy(){
        return studyService.getALLCaseStudy();
    }

    @GetMapping("/singleCase")
    public Case getCase(@RequestParam(value = "disease_name") String disease_name) {
        List<Case> cases = caseService.getCase(disease_name);
        return cases.get(0);
    }
}
